﻿/*
 * Created by SharpDevelop.
 * User: lebeda
 * Date: 7.2.2014
 * Time: 11:14
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Windows.Forms;

namespace simpleExplorer
{
    /// <summary>
    /// Class with program entry point.
    /// </summary>
    internal sealed class Program
    {
        /// <summary>
        /// Program entry point.
        /// </summary>
        [STAThread]
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            
            var options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                
                // TODO - check if dir exists 
                MenuItem menuItem;
                if (!String.IsNullOrWhiteSpace(options.notes)) {
                    menuItem = new MenuItem("", ItemTarget.menu, ItemType.noteMenuProvider, options.notes, "", "", null);
                } else if (!String.IsNullOrWhiteSpace(options.dirmenu)) {
                    menuItem = new MenuItem("", ItemTarget.menu, ItemType.filesystemMenuProvider, options.dirmenu, "", "", null);
                } else if (!String.IsNullOrWhiteSpace(options.dirRecurse)) {
                    menuItem = new MenuItem("", ItemTarget.menu, ItemType.fsRecurciveMenuProvider, options.dirRecurse, "", "", null);
                } else {
                    throw new NotSupportedException("Cannot identify any startup menu");
                }
                
                Application.Run(new MainForm(menuItem, options));
            }
        }
        
    }
    

    // TODO virtual (generated) menu items
    // TODO write readme with simple manual
}
